# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>

pkgname=python-ubjson
pkgver=0.16.1
pkgrel=6
pkgdesc='Universal Binary JSON draft-12 serializer for Python'
arch=(loong64 x86_64)
url='https://github.com/Iotic-Labs/py-ubjson'
license=(Apache)
makedepends=(python-setuptools)
depends=(python)
source=("https://files.pythonhosted.org/packages/source/p/py-ubjson/py-ubjson-$pkgver.tar.gz"{,.asc})
sha256sums=('b9bfb8695a1c7e3632e800fb83c943bf67ed45ddd87cd0344851610c69a5a482'
            'SKIP')
validpgpkeys=(
  'A262040D27F5F4700D097A02CF651F44EF65072E'  # Iotic Labs Ltd (Software release signing key) <info@iotic-labs.com>
)

build() {
  cd py-ubjson-$pkgver
  python setup.py build
}

check() {
  cd py-ubjson-$pkgver
  pyver=$(python -c "import sys; print('{}{}'.format(*sys.version_info[:2]))")
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-$pyver" python -m unittest discover -v test
}

package() {
  cd py-ubjson-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}
